#include <stdio.h>
#include <stdlib.h>
#include <iostream>
typedef char VertexType;
typedef int EdgeType;
#define MAXVEX 100

typedef struct EdgeNode   /// 边
{
	int adjvex;
	EdgeType weight;
	EdgeNode *next;
}EdgeNode;

typedef struct VertexNode  /// 顶点
{
	VertexType data;
	EdgeNode *firstedge;	
}VertexNode, AdjList[MAXVEX];


typedef struct 
{
	AdjList adjList;
	int numVertexes, numEdges;
}GraphAdjList;


/// 利用头指针插入不停的替换他们的firstedge，把之前插入边节点插入到firstedge后面形成单链表
void CreateGLGraph(GraphAdjList *G)
{
	EdgeNode *e;
	printf("输入顶点数和边数：\n");
	scanf("%d, %d", &G->numVertexes, &G->numEdges);
	for (int i = 0; i < G->numVertexes; ++i)
	{
		scanf(&G->adjList[i].data);
		G->adjList[i].firstedge = NULL;
	}

	for (int k = 0; k < G->numEdges; ++k)
	{
		std::cout << "输入边(vi, vj)上的顶点序号:" << std::endl;
		int i, j;
		std::cin >> i >> j;

		EdgeNode *e = (EdgeNode *)malloc(sizeof(EdgeNode));
		e->adjvex = j;
		e->next = G->numVertexes[i]->firstedge;
		G->numVertexes[i]->firstedge = e;
	}
}

int main()
{
	GraphAdjList g;
	CreateGLGraph(&g);
	return 0;
}